<script>
function addVirtualProject(funcId) {
	var url = TDQS.CONTEXT_PATH+"business/process?tdqssid="+TDQS.SESSION_ID+"&function.id="+funcId+"&businessInstance.id="+$('#businessInstanceId').val()+"&form.id="+$('#formId').val();
	url += "&date="+new Date().toLocaleString();
	document.location.href = url;
}
function editVirtualProject(funcId,companyId){
	if(funcId && funcId!='') {
		var url = TDQS.CONTEXT_PATH+"business/process?tdqssid="+TDQS.SESSION_ID+"&function.id="+funcId+"&businessInstance.id="+$('#businessInstanceId').val()+"&paramsMap['assistCompanyIds'].value="+companyId+"&form.id="+$('#formId').val();
		url += "&date="+new Date().toLocaleString();
		document.location.href = url;
	}
}
function removeVirtualProject(instanceId){
	$.tdqsAjax({
		type: "post",
		dataType: "json",
		url: TDQS.CONTEXT_PATH+'business/removeVirtualProject?tdqssid='+TDQS.SESSION_ID+"&id='+instanceId,
		success:function(json) {
			$('#'+instanceId).remove();
		}
	});
}
</script>
<#if businessInstanceField.objectValue??>
<#list businessInstanceField.objectValue as virtualPlan>
<div id="${virtualPlan.businessInstance.id}" style="margin-left:5px;margin-top:5px;margin-buttom:5px;">
<a href="javascript:void(0);" onclick="editVirtualProject('<#if formField.group?? && formField.group.function?? && formField.group.function.id??>${formField.group.function.id}</#if>','${virtualPlan.businessInstance.company.id?c}');return false;">${virtualPlan.businessInstance.company.name}</a>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="removeVirtualProject('${virtualPlan.businessInstance.id}');return false;">删除</a>
</div>
</#list>
</#if>
<div style="margin-left:5px;margin-top:5px;margin-buttom:5px;">
<a href="javascript:void(0);" <#if formField.group?? && formField.group.function?? && formField.group.function.id??>onclick="addVirtualProject('${formField.group.function.id}');return false;"</#if>><b>添加协办单位</b></a>
</div>